<?php
header("Content-Type: application/json; charset=UTF-8");
require_once 'db.php';

$sql = "SELECT * FROM banners WHERE status = 1 ORDER BY sort_order ASC LIMIT 5";
$result = $conn->query($sql);

$banners = [];
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $banners[] = $row;
    }
}

echo json_encode([
    'status' => 'success',
    'banners' => $banners
]);

$conn->close();
?> 